<!DOCTYPE html>
<html lang="en">
 <head>
  <meta charset="UTF-8">  
  <title>家具列表</title>
 </head>
 <body>
 <?php
  require_once('system/dbConnect.php');
   require_once('system/MyFunc.php'); 
  connect();
  //编写sql语句
  $sql = "select jiaju.*,category.wn_cname from jiaju join category on jiaju.wn_cid = category.wn_cid"; 
  $result = fetch_array($sql);
   //var_dump($result);
 ?>
 <center><h1>家具列表</h1></center>
 <table align="center" width="80%" border=1>  
           <tr>
             <th>家具图片</th>
             <th>家具名称</th>
             <th>所属类别</th>
             <th>添加时间</th>
             <th>操作</th>
           </tr>
           <?php
           // if(is_array($result))
           //   {    
                foreach ($result as $row) 
                 {
                   echo '<tr>';
                   echo '<td align="center"><img src=upload/'.$row['wn_jiajulink'].' width=60 height=80 alt="无图片"></td>';
                   echo '<td><a href="detail.php?id='.$row['wn_id'].' ">'.$row['wn_name'].'</a></td>'; 
                   echo '<td>'.$row['wn_cid'].'</td>';
                   echo '<td>'.$row['wn_adddate'].'</td>';
                   echo '<td><a href="jiaju.php?id='.$row['wn_id'].' ">修改</a> | 
                         <a href="del.php?id='.$row['wn_id'].'" >删除</a>
                        </td>';
                   echo '</tr>';  
                 }
                echo '</table>';  
              // }
            $totalrows = count($result);
            echo "<table align='center'><tr><td>共有{$totalrows}条家具记录</td></tr></table>";
           ?>
 </body>
</html>
